.TH MEMSE 1 "26 February 2006" "WFDB 10.4.0" "WFDB Applications Guide"
.SH NAME
memse \- estimate power spectrum using maximum entropy (all poles) method
.SH SYNOPSIS
\fBmemse\fR [ \fIoptions ...\fR ] \fIinput-file\fR
.SH DESCRIPTION
.PP
\fBmemse\fR transforms a real-valued time series (from the specified
\fIinput-file\fR, or from the standard input if \fIinput-file\fR is
specified as ``-''; \fIinput-file\fR must be in text form) into a power
spectrum (on the standard output).  \fBmemse\fR is designed to be used
in much the same way as \fBfft\fR(1); it accepts the same input,
produces output in the same format, and accepts many of the same
options used with \fBfft\fR.
.PP
Unlike \fBfft\fR, which bases its spectral estimates on the discrete Fourier
transform, \fBmemse\fR uses the maximum entropy (all poles) method, also known
as autoregressive (AR) spectral estimation.  This method models the spectrum
by a series expansion in which the free parameters are all in the denominators
of its terms;  hence each term may represent a pole (corresponding to infinite
power spectral density within an infinitely narrow frequency band).  By
contrast, Fourier analysis models the spectrum by a series expansion in which
the free parameters are all in the numerators;  hence each term in a Fourier
series may represent a zero.  All-poles models are particularly useful for
analysis of spectra which have discrete peaks (in the terminology of optical
spectra, ``lines'').
.PP
In order to use \fBmemse\fR, you should have some idea of the order of the
model you wish to use (i.e., the number of poles).  Although this may be any
number up to the number of input points, the number of poles generally should
not exceed the square root of the number of input points, and usually should
be considerably less than that number.  Large numbers of poles lead to lengthy
computations (much slower than the FFT) in which accumulated roundoff error
becomes a serious problem.  This problem may also occur if the length of the
input series becomes excessive.  The recommended way to use \fBmemse\fR is
to begin by using \fBfft\fR, in order to estimate the model order.  Typically
this should be a small multiple of the number of peaks which you \fIbelieve\fR
are present.  Beware!  \fBmemse\fR will produce smooth spectral estimates for
whatever model order you choose -- and they may be totally bogus if you choose
incorrectly.  Varying the model order can help to weed out some spurious
features, but use extreme care when interpreting \fBmemse\fR output given noisy
input.
.PP
\fIOptions\fR are:
.TP
\fB-b\fR \fIlow high\fR [ \fIlow high ...\fR ]
Print power in the specified bands.  Each \fIlow\fR and \fIhigh\fR pair
specifies the low and high frequency boundaries of the band of interest,
in Hz.  Multiple bands may be specified following a single \fB-b\fR option;
only the last \fB-b\fR option has any effect.  Also see \fB-s\fR below.
.TP
\fB-f\fR \fIfrequency\fR
Show the center frequency for each bin in the first column.  The
\fIfrequency\fR argument specifies the input sampling frequency;  the center
frequencies are given in the same units.
.TP
\fB-h\fR
Print a usage summary.
.TP
\fB-n\fR \fIn\fR
Produce exactly \fIn\fR power estimates, evenly spaced in frequency from 0
up to half the input sampling frequency inclusive.  The default depends on
the length of the input series;  it is designed to match \fIfft\fR's defaults,
to make it easy to compare outputs.  You may wish to use values of \fIn\fR
which are higher than the default in order to improve your estimates of the
locations of sharp features in the spectrum;  since this is not possible using
\fBfft\fR, this feature is one of the main advantages of \fImemse\fR.
.TP
\fB-o\fR \fIn\fR
Use an \fIn\fRth order model (i.e., up to \fIn\fR poles).  Default:  the
square root of the number of input samples.
.TP
\fB-P\fR
Generate a power spectrum (print squared magnitudes).
.TP
\fB-s\fR
Print power in a standard set of frequency bands of interest for HRV analysis.
.TP
\fB-w\fR \fIwindow-type\fR
Apply the specified window to the input data.  \fIwindow-type\fR may be
one of: `Bartlett', `Blackman', `Blackman-Harris', `Hamming', `Hanning',
`Parzen', `Square', and `Welch'.  The `Square' window type is equivalent to
using no window at all;  this is also variously known as a rectangular or
Dirichlet window.
.TP
\fB-z\fR
Add a constant to each input sample, chosen such that the mean value of the
entire series is zero.
.TP
\fB-Z\fR
Set the mean value of the inputs to zero as for \fB-z\fR, and detrend the
series (set its mean first derivative to zero).  This is equivalent to
subtracting a best-fit (by least squares) line from the input data.
.SH NOTES
Versions of \fBmemse\fR released prior to September 1999 did not support the
\fB-P\fR option, and did not normalize amplitudes with respect to the number
of output points.
.SH SEE ALSO
\fBfft\fR(1), \fBhrfft\fR(1), \fBlomb\fR(1)
.SH AUTHOR
George B. Moody (george@mit.edu)
.SH SOURCE
http://www.physionet.org/physiotools/wfdb/psd/memse.c
